2025.7.16 3Dグラフ(ドット)【matplotlib】
scatter 関数を使う。
code:p.py
import torch as pt
import matplotlib.pyplot as plt
xx = pt.linspace(-5, 5, 20)
xy = pt.linspace(-5, 5, 20)
xxx, yyy = pt.meshgrid(xx, yy, indexing='xy')
zzz = (xxx**2 + yyy - 11)**2 + (xxx + yyy**2 - 7)**2
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.scatter(xxx, yyy, zzz)
plt.show()
https://scrapbox.io/files/68775508813619d1ee56b000.png